﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ExamSharedClasses.Commands;
using ExamSharedClasses;

namespace ExamClient
{
    /// <summary>
    /// (k) Der Frame, um eine Frage mit Textantwort darzustellen
    /// </summary>
    public partial class QuestionTypeTextPage : Page {
        public AnswerTypeText AnswerTypeText { get; set; }

        public QuestionTypeTextPage( AnswerTypeText answerTypeText ) {
            this.AnswerTypeText = answerTypeText;
            InitializeComponent();
            UpdateWindow();
            answerTextBox.Focus();
        }

        public void UpdateWindow() {
            questionTextBlock.Text = ( ( QuestionTypeText )AnswerTypeText.AnswerQuestion ).QuestionBody;
        }

        private void answerButton_Click( object sender, RoutedEventArgs e ) {
            AnswerTypeText.AnswerUserId = App.UserAddress.UserId;
            AnswerTypeText.AnswerUserAnswer = answerTextBox.Text;
            passButton_Click( null, null );
        }
        private void passButton_Click( object sender, RoutedEventArgs e ) {
            App.ExamPage.BindNextPageToFrame();
        }
    }
}
